import VueRouter from 'vue-router'
import Vue from 'vue'

import Home from '../components/Home/Home.vue'



Vue.use(VueRouter)

var router=new VueRouter({
    routes:[
        {
            path:'/',
            redirect:'/home'
        },
        {
            path:'/home',
            component:Home,
        }

    ],
    mode:'history'
    
})

// 经验证，这个路由守卫没什么用，因为vue-router在跳转的路径相同的时候，在执行这个路由守卫之前就拦截了
router.beforeEach((to, from, next) => {
    // console.log(to.path===from.path)
    if(to.path===from.path){
        console.log('路由相等啦')
       return

    } else {
        next()
    }
})


export default router

